package com.dk.controller;


import com.dk.service.ShopService;
import com.dk.vo.ShopVO;
import com.dongdongshop.data.Result;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  车间controller
 * </p>
 *
 * @author wbh
 * @since 2023-03-21
 */
@RestController
@RequestMapping("shop")
public class ShopController {
    @Autowired
    private ShopService shopService;

    @GetMapping("getInfoList")
    public Result getInfoList(ShopVO shopVO){
        List<ShopVO> shopVOList = shopService.getInfoList(shopVO);
        return Result.OK().setData(shopVOList);
    }

    @PostMapping("insertInfoShop")
    public Result insertInfoShop(ShopVO shopVO){
       shopService.insertInfoShop(shopVO);
        return Result.OK();
    }

    @GetMapping("getInfoShopById")
    public Result getInfoShopById(String shopCode){
        ShopVO shopVO = shopService.getInfoShopById(shopCode);
        return Result.OK().setData(shopVO);
    }

    @PutMapping("updateInfoShopById")
    public Result updateInfoShopById(ShopVO shopVO){
        shopService.updateInfoShopById(shopVO);
        return Result.OK();
    }

    @DeleteMapping("deleteInfoShopById")
    public Result deleteInfoShopById(String shopCode){
        shopService.deleteInfoShopById(shopCode);
        return Result.OK();
    }

}

